<template>
  <slot></slot>
</template>
<script setup lang="ts">
import { toast } from "vue-sonner";
import { injectHttpStatusErrorHandler } from "~/composables/common/http";
import { useRouter } from "vue-router";
const router = useRouter();
useHttpStatusError();
function useHttpStatusError() {
  injectHttpStatusErrorHandler(async (message, statusCode) => {
    console.log(statusCode);
    switch (statusCode) {
      case 401:
        toast.error(message, {
          duration: 3000,
          onAutoClose() {},
        });
        break;
      case 200:
        toast.success(message || "操作成功", {
          duration: 3000,
        });
        break;
      default:
        toast.warning(message);
        break;
    }
  });
}
</script>

<style scoped></style>
